 <%@ page language="java" import="java.util.*" pageEncoding="utf-8" import="pojo.*,base.*,service.*,java.text.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <style type="text/css">

#all a {
           text-decoration:none;
           color:black;
           }

#all a:link,.toptext a:visited{color:black;}
#all a:hover{color:#A020F0;}  


img{border:none;}
 body{
	margin:0;
	padding:40px;
	background-image:url("images/bj.jpg");
	background-repeat:no-repeat;
	font:80% Arial, Helvetica, sans-serif;
	color:#555;
	line-height:100%;
}  
#tooltip{
	position:absolute;
	border:1px solid #ccc;
	background:#333;
	padding:2px;
	display:none;
	color:#fff;
}
   
 .STYLE1 {font-size: 100%
          }
  </style>
 <script type="text/javascript" src="${pageContext.request.contextPath}/jquery/jquery-1.7.2.min.js"></script>
 <script>
 function deleteP(url){
  if(deleteconfirm()){
  location.href=url;
  }
 }
 function deleteconfirm(){
	if(confirm("确认要删除数据吗"))
		return true;
	return false;
 }
 $(function(){
	var x = 10;
	var y = 10;
	$("a.tooltip").mouseover(function(e){
		this.myTitle = this.title;
		this.title = "";	
		var imgTitle = this.myTitle? "<br/>" + this.myTitle : "";
		var tooltip = "<div id='tooltip'><img width= 300 height=300 src='"+ this.href +"' alt='产品预览图'/>"+imgTitle+"<\/div>"; //创建 div 元素
		$("body").append(tooltip);	//把它追加到文档中						 
		$("#tooltip")
			.css({
				"top": (e.pageY+y) + "px",
				"left":  (e.pageX+x)  + "px"
			}).show("fast");	  //设置x坐标和y坐标，并且显示
    }).mouseout(function(){
		this.title = this.myTitle;	
		$("#tooltip").remove();	 //移除 
    }).mousemove(function(e){
		$("#tooltip")
			.css({
				"top": (e.pageY+y) + "px",
				"left":  (e.pageX+x)  + "px"
			});
	});
})
 </script>
<script language="javascript">
function unload()
{
var popUpSizeX=600; //窗口的宽度
var popUpSizeY=500; //窗口的高度

var popUpLocationX=700;//距离左边的距离 相当于 left
var popUpLocationY=300;//距离顶端的距离 相当于 top

// URL of the popUp
var popUpURL="addPic.jsp"; //打开页面的路径

// ** 下面的就不要随便改了 ***
splashWin = window.open("",'x','fullscreen=1,scrollbars=yes,resizable=0,toolbar=no, menubar=no,');
splashWin.blur(); // Hide while updating
window.focus();
splashWin.resizeTo(popUpSizeX,popUpSizeY);
splashWin.moveTo(popUpLocationX,popUpLocationY);
splashWin.location=popUpURL;
}

</script> 
  </head>
  
  <body>
   <div id="all">
     <div align="right"><a href="#" onclick="unload()">添加图片</a>
     
     </div>
     <div id="list">
<%
	request.setCharacterEncoding("utf-8");
   PictureService ps = new PictureService();
    int size=ps.getALL();//获取总数量	
	List<pic> list = ps.getpic();//按参数查询
		  
		
	
			
%>
 
</div>

<
<center>

	<table width="900" border="1">
      <tr>
        <td width="70"><div align="center">图片主题</div></td>
        <td width="50"><div align="center"> 图片介绍</div></td>
        <td width="100"><div align="center"> 图片</div></td>
        <td width="100"><div align="center"> 上传时间</div></td>
         <td width="70"><div align="center"> 操作</div></td>
        
        
      </tr>
<%
    
	for (pic inf : list) {
	out.println("<td><div align='center'>"+inf.getTopic()+"</div></td>");
	out.println("<td><div align='center'>"+inf.getDetail()+"</div></td>");
	out.println("<td><div align='center'><a href="+inf.getPic()+" class='tooltip' title="+inf.getTopic()+"><img id='img' height=100 width=100 src="+inf.getPic()+"></a></div></td>");
	out.println("<td><div align='center'>"+inf.getTime()+"</div></td>");
	out.println("<td><div align='center'><input type='button' onclick=deleteP('action/deletePic.jsp?id="+inf.getId()+"'); value='删除'/></div></td></tr>");
	}
	%>
	
</table>
  </center>
 
  </div>
	
  </body>
</html>
